import request from '@/utils/request'

export function getPurchaseOrderList(params) {
  return request({
    url: '/mobile/getPurchaseOrderList',
    method: 'get',
    params
  })
}

export function createPurchaseOrder(data) {
  return request({
    url: '/mobile/purchase-order',
    method: 'post',
    data
  })
}

export function getPurchaseOrderDetail(id) {
  return request({
    url: `/mobile/purchase-order/${id}`,
    method: 'get'
  })
}

export function updatePurchaseOrder(id, data) {
  return request({
    url: `/mobile/purchase-order/${id}`,
    method: 'put',
    data
  })
}

export function approvePurchaseOrder(id) {
  return request({
    url: `/mobile/purchase-order/${id}/approve`,
    method: 'put'
  })
}

export function rejectPurchaseOrder(id) {
  return request({
    url: `/mobile/purchase-order/${id}/reject`,
    method: 'put'
  })
}